package net.lovesrc.allin.biz.treex;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.http.client.HttpClient;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Getter
public class UserSessionMeta {

    private HttpClient httpClient;

    private JSONObject userJson;

    public UserSessionMeta(HttpClient httpClient, JSONObject userJson) {
        this.httpClient = httpClient;
        this.userJson = userJson;
    }

    public static void main(String[] args) {
        List<User> userList = new ArrayList<>();

        userList.add(new User(1,"zz"));
        userList.add(new User(2,"xx"));
        userList.add(new User(3,"ll"));

        List<User> zxl = userList.stream().filter(user -> {
            if (user.getId() == 1) {
                user.setUsername("zxl");
                return true;
            }
            return false;
        }).collect(Collectors.toList());

        System.out.println(zxl);
    }

}


@AllArgsConstructor
@NoArgsConstructor
@Data
class User{
    private Integer id;


    private String username;
}